package com.ioc.dao;

import com.ioc.bean.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;

/**
 * @author xinwang
 * @date 2020/2/23 14:59
 **/
public class UserDao {

    private JdbcTemplate jdbcTemplate = new JdbcTemplate();

    public void add(User user) {
        String sql = "insert into users(name,sex,age) value(?,?,?);";
        int updateResult = jdbcTemplate.update(sql, user.getName(), user.getSex(), user.getAge());
        System.out.println("updateResult = " + updateResult);
    }
}
